package 数据结构.章节10._168_实现HashMap;

import org.junit.Test;

import java.util.Iterator;

/**
 * @author 挚爱之夕
 * @date 2021/10/15 - 10 - 15 - 20:50
 * @Description: 数据结构.章节10._168_实现HashMap
 * @Version: 1.0
 */
public class MyHashMapTest {
    MyHashMap<Object,Object> map = new MyHashMap<>();
    @Test
    public void put() {
        map.put("one",1);
        map.put("two",2);
        map.put("three",3);
        map.put("one",11);
        System.out.println(map);
        map.remove("one");
        System.out.println(map.containsKey("one")+" "+map.containsValue(2));
        Object[] objects = map.valueSet();
        for (Object o:objects
             ) {
            System.out.println(o);
        }
        map.clear();
        System.out.println(map);
    }

    @Test
    public void iterator() {
        map.put("one",1);
        map.put("two",2);
        map.put("three",3);
        map.put("one",11);
        Iterator<Node> iterator = map.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}